<%@page contentType="text/html; charset=utf-8" language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%@page import="com.cndatacom.eweb.common.UploadFile"%>
<%@page import="com.cndatacom.eweb.utils.RandomUtils"%>

<% 
	String ctx = request.getContextPath();
%>
<link href="<%=ctx%>/common/css/upload-component.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=ctx%>/js/upload.js"></script>

<%
	response.setContentType("text/html");
	response.setHeader("cache-control","no-store");
	response.setHeader("pragrma","no-cache");
	response.setDateHeader("expires",0);
	UploadFile uploadFile = (UploadFile)request.getAttribute("uploadFile");
	double sumSize = 0.0;
	double uploaded = 0.0;
	double hasSize = 0.0;
	int percent = 0;
	String unit = "";
	if(uploadFile!=null){
 		sumSize = uploadFile.getSize()/1024;
 		if(sumSize>1024){
     		sumSize = uploadFile.getSize()/1024/1024;
	 		uploaded = uploadFile.getUploaded()/1024/1024;
	 		hasSize =  sumSize-uploaded;
	 		unit = "MB";
 		}else{
	 		uploaded = uploadFile.getUploaded()/1024;
	 		hasSize =  sumSize-uploaded;
	 		unit = "KB";
 		}
 		percent = uploadFile.getPercent();
	}
%>
   <%if(uploadFile!=null){%>
		    <tr>
		        <Td>
		            	上传中的文件:<%=uploadFile.getName()%>
		        </Td>
		    </tr>
		    <tr>
		    	<div class="Progress-Bar-bg" style="height:20;width:380px">
                <div class="Progress-bar-color" style="float: left;height:20;width:<%=percent*3.8%>px"></div>
		    </tr>
		    <tr>
		        <Td>
                    </div>
                       大小:<%=RandomUtils.roundDouble(sumSize,2)%>(<%=unit%>),已传:<%=RandomUtils.roundDouble(uploaded,2)%>(<%=unit%>),剩余:<%=RandomUtils.roundDouble(hasSize,2)%>(<%=unit%>),
                    <span><%="上传进度:"+percent+"%"%> </span>
		        </Td>
		    </tr>

<%}%>
	<input type="hidden" id="messageInfo" value="<s:property value="messageInfo"/>" />